package cc.lishixi.book.dao.mapper;

import cc.lishixi.book.entity.Book;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by LiShixi on 2016/7/23 0023.
 * http://www.lishixi.cc
 */
public class BookRowMapper implements RowMapper<Book> {
    @Override
    public Book mapRow(ResultSet resultSet, int i) throws SQLException {
        Book book = new Book();
        book.setId(resultSet.getInt("id"));
        book.setName(resultSet.getString("name"));
        book.setSeries(resultSet.getString("series"));
        book.setAuthors(resultSet.getString("authors"));
        book.setPublisher(resultSet.getString("publisher"));
        book.setSize(resultSet.getString("size"));
        book.setPages(resultSet.getInt("pages"));
        book.setPrice(resultSet.getFloat("price"));
        book.setIntroduction(resultSet.getString("introduction"));
        book.setPicture(resultSet.getString("picture"));
        book.setClnum(resultSet.getString("clnum"));
        return book;
    }
}
